home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / DBTOOLC.LZH / SOURCE.ARC / SAVWINDO.C < prev   
Text File  |  1985-06-11  |  929b  |  27 lines

  1. /* save a windo on the screen to memory */
  2. savwindo(uplr,uplc,lrr,lrc,buffer)
  3. int uplc,uplr; /* upper left column and row coordinates */
  4. int lrc,lrr;   /* lower right corner (col and row) */
  5. char *buffer;  /* pointer to buffer area to save screen */
  6. {
  7.   int length;  /* length of each row to save */
  8.   int i;       /* counter fro for loop */
  9.   int actpage,mode,cols; /* current screen attributes */
  10.  
  11.   getscmod(&mode,&cols,&actpage);
  12.   if (mode > 3 && mode < 7)    /* graphics modes are not supported */
  13.     return(-1);
  14.  
  15.   length = lrc - uplc + 1;   /* length= right corner - left corner */
  16.   if (length == cols){         /* saving contiguous area */
  17.     scrtomem( (lrr-uplr+1) * length,((uplr * cols) + uplc)*2,buffer);
  18.                  /*    offset into screen memory, length in bytes  */
  19.   }else{
  20.     for(i=uplr;i<=lrr;i++){
  21.  
  22.         scrtomem( length, ((i * cols)+uplc)*2,buffer);
  23.         buffer += (length*2);
  24.     }
  25.   }
  26. }
  27.